<template>
<div id="app">
    <hr style="border: none"/>
    <div>
        <el-form :inline="true" :model="queryForm.data" class="demo-form-inline">
            <el-form-item>
                <el-select v-model="queryForm.data.collegeCode" clearable placeholder="请选择学院">
                    <el-option
                            v-for="item in options.collegeCode"
                            :key="item.id"
                            :label="item.text"
                            :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-date-picker
                        v-model="queryForm.data.year"
                        type="year"
                        placeholder="选择年份"
                        value-format="yyyy">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="loadEcharts" icon="el-icon-search">查询</el-button>
            </el-form-item>
        </el-form>
    </div>
    <div align="center">
        <span style="font-family: 微软雅黑font-size: 20px">潍坊学院{{queryForm.data.year}}年度</span>
        <br/>
        <span style="font-size: 18px">学生就业情况</span>
    </div>
    <hr>

    <div style="height:2800px">
        <el-row :gutter="10">
            <el-col :span="6" style="width: 100%">
                <el-card :body-style="{ padding: '0px',height: '80%' }">
                    <div slot="header" class="clearfix">
                        <span>横向对比-学院对比</span>
                    </div>
                    <college-employ-compare v-bind:year="this.queryForm.data.year" class="echarts"></college-employ-compare>
                </el-card>
            </el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="6" style="width: 100%">
                <el-card :body-style="{ padding: '0px',height: '80%' }">
                    <div slot="header" class="clearfix">
                        <span>横向对比-专业对比</span>
                    </div>
                    <major-employ-compare v-bind:year="this.queryForm.data.year"
                        v-bind:collegeCode="this.queryForm.data.collegeCode"
                        class="echarts"></major-employ-compare>
                </el-card>
            </el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="6" style="width: 100%">
                <el-card :body-style="{ padding: '0px',height: '80%' }">
                    <div slot="header" class="clearfix">
                        <span>潍坊学院整体就业率变化趋势</span>
                    </div>
                    <school-employ-trend class="echarts"></school-employ-trend>
                </el-card>
            </el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="6" style="width: 100%">
                <el-card :body-style="{ padding: '0px',height: '80%' }">
                    <div slot="header" class="clearfix">
                        <span>潍坊学院XX学院就业率变化趋势</span>
                    </div>
                    <college-employ-trend  v-bind:collegeCode="this.queryForm.data.collegeCode"
                        class="echarts"></college-employ-trend>
                </el-card>
            </el-col>
        </el-row>
        <el-row :gutter="10">
            <el-col :span="6" style="width: 100%">
                <el-card :body-style="{ padding: '0px',height: '80%' }">
                    <div slot="header" class="clearfix">
                        <span>潍坊学院XX学院XX专业就业率变化趋势</span>
                    </div>
                    <!-- todo 这个标签要传递 专业的code ，现在没有专业的框 -->
                    <major-employ-trend  v-bind:majorCode="this.queryForm.data.collegeCode"
                        class="echarts"></major-employ-trend>
                </el-card>
            </el-col>
        </el-row>
    </div>
  </div>


</template>

<script>
import CollegeEmplyCompare from './college-compare.vue'
import MajorEmplyCompare from './major-compare.vue'
import SchoolEmployTrend from './school-employ-trend.vue'
import CollegeEmployTrend from './college-employ-trend.vue'
import MajorEmployTrend from './major-employ-trend.vue'

export default {
  name: 'Total',
  components: {
    'college-employ-compare': CollegeEmplyCompare,
    'major-employ-compare': MajorEmplyCompare,
    'school-employ-trend': SchoolEmployTrend,
    'college-employ-trend': CollegeEmployTrend,
    'major-employ-trend': MajorEmployTrend
  },
  data () {
    return {
      url: {
        collegeOptions: '/datacenter/college/query/spinner'
      },
      queryForm: {
        dialogFormVisible: false,
        data: {
          collegeCode: '',
          year: ''
        }
      },
      options: {
        collegeCode: []
      }
    }
  },
  methods: {
    loadEcharts: function () {}
  },
  mounted: function () {
    // 初始化操作
    this.$http.get(this.$http.adornUrl(this.url.collegeOptions)).then(
      (res) =>  {
        if (res.data.success) {
          this.options.collegeCode = res.data.data
        } else {
          this.$message({
            type: 'error',
            message: res.data.info
          })
        }
      },
      (res) =>  {
        this.$message({
          showClose: true,
          message: '网络错误,code=' + res.status,
          type: 'error'
        })
      }
    )
  }
}
</script>
<style>
.el-card {
  height: 100%
}

.time {
  font-size: 13px;
  color: #999
}

.bottom {
  margin-top: 13px;
  line-height: 12px
}

.button {
  padding: 0;
  float: right
}

.image {
  width: 100%;
  display: block
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: ""
}

.clearfix:after {
  clear: both
}
.el-col {
  width: 50%;
  height: 100%
}

.echarts {
  width: 100%;
  height: 100%
}
</style>
